/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package meteocal.boundary;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import meteocal.weather.Weather;
import org.primefaces.model.ScheduleEvent;

/**
 *
 * @author andrea
 */
public class MyScheduleEvent implements ScheduleEvent,Serializable {

        private String id;
        private String emailCreator;
        private Long idLong;
        private Date startDate;
        private Date endDate;
        private String title;
        private String place;
        private boolean visible;
        private List<String> invitedMail;
        private boolean editable;
        private Weather badWeather;
        private boolean outdoor;
        
        
        

        
        MyScheduleEvent(Long id,String emailCreator,String title, String place ,Date start, Date end, boolean visible) {
        this.id = id.toString();
        this.idLong = id;
        this.title = title;
        this.place = place;
        this.startDate = start;
        this.endDate = end;
        this.visible = visible;
        this.emailCreator = emailCreator;
        }
        
        MyScheduleEvent(Long id,String emailCreator,String title, String place ,Date start, Date end, boolean visible,boolean editable,Weather badWeather,boolean outdoor) {
        if( id!= null){
            this.id = id.toString();
            this.idLong = id;
        }
        this.title = title;
        this.place = place;
        this.startDate = start;
        this.endDate = end;
        this.visible = visible;
        this.emailCreator = emailCreator;
        this.editable = editable;
        if(badWeather == null){
            this.badWeather = Weather.RAINY;
        }else{
            this.badWeather = badWeather;
        }
        this.outdoor = outdoor;
        
        }
        
        MyScheduleEvent(){
            this.id = new String();
            this.startDate = new Date();
            this.endDate = new Date();
            this.title = new String();
            this.place = new String();
        }

        @Override
        public String getId() {
            return this.id;
        }

        @Override
        public void setId(String string) {
            this.id = string;
        }

        @Override
        public Object getData() {
            return null;
        }

        @Override
        public String getTitle() {
            return this.title;
        }

        @Override
        public Date getStartDate() {
            return this.startDate;
        }

        @Override
        public Date getEndDate() {
            return this.endDate;
        }

        @Override
        public boolean isAllDay() {
            return false;
        }

        @Override
        public String getStyleClass() {
            return " ";
        }

        @Override
        public boolean isEditable() {
            return this.editable;
        }

        @Override
        public String getDescription() {
            return "desc";
        }
        
        @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MyScheduleEvent other = (MyScheduleEvent) obj;
        if ((this.getTitle() == null) ? (other.getTitle() != null) : !this.title.equals(other.title)) {
            return false;
        }
        if (this.getStartDate() != other.getStartDate() && (this.getStartDate() == null || !this.startDate.equals(other.startDate))) {
            return false;
        }
        if (this.getEndDate() != other.getEndDate() && (this.getEndDate() == null || !this.endDate.equals(other.endDate))) {
            return false;
        }
        return true;
    }
        
        @Override
    public int hashCode() {
        int hash = 5;
        hash = 61 * hash + (this.getTitle() != null ? this.getTitle().hashCode() : 0);
        hash = 61 * hash + (this.getStartDate() != null ? this.getStartDate().hashCode() : 0);
        hash = 61 * hash + (this.getEndDate() != null ? this.getEndDate().hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "DefaultScheduleEvent{title=" + getTitle() + ",startDate=" + getStartDate() + ",endDate=" + getEndDate() + "}";
    }

        /**
         * @return the place
         */
        public String getPlace() {
            return place;
        }
        
        public void setTitle(String title){
            this.title=title;
        }

        /**
         * @param place the place to set
         */
        public void setPlace(String place) {
            this.place = place;
        }

    /**
     * @return the visible
     */
    public boolean isVisible() {
        return visible;
    }

    /**
     * @param visible the visible to set
     */
    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    void setInvited(List<String> invitedMail) {
        this.invitedMail = invitedMail;
    }

    /**
     * @return the invitedMail
     */
    public List<String> getInvitedMail() {
        return invitedMail;
    }

    /**
     * @return the idLong
     */
    public Long getIdLong() {
        return idLong;
    }

    /**
     * @param idLong the idLong to set
     */
    public void setIdLong(Long idLong) {
        this.idLong = idLong;
    }

    /**
     * @return the emailCreator
     */
    public String getEmailCreator() {
        return emailCreator;
    }

    /**
     * @param emailCreator the emailCreator to set
     */
    public void setEmailCreator(String emailCreator) {
        this.emailCreator = emailCreator;
    }

    void setBadWeather(Weather badWeatherSelected) {
        this.badWeather = badWeatherSelected;
    }

    /**
     * @return the badWeather
     */
    public Weather getBadWeather() {
        return badWeather;
    }

    /**
     * @return the outdoor
     */
    public boolean isOutdoor() {
        return outdoor;
    }

    /**
     * @param outdoor the outdoor to set
     */
    public void setOutdoor(boolean outdoor) {
        this.outdoor = outdoor;
    }

}

